<article class="module width_full"> 
<header>
	<h3 class="tabs_involved">Quản lý công ty
	<input type='submit' value='Xóa' style='margin:5px;float:right;' onclick='deleteCompany();'/>
	<input type='submit' value='Thêm' style='margin:5px;float:right;' onclick='window.location="<?php echo base_url('/index.php/admin/managecompany/add');?>"'/><br>
</h3>
</header><br>

<form action="<?php echo base_url('/index.php/admin/managecompany/delete');?>" method="post" enctype="multipart/form-data" id="form">
<div class="tab_container">
	<div id="tab1" class="tab_content">
		<table class="tablesorter" cellspacing="0">
			<thead>
				<tr>
					<th><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></th>
					<th>STT</th>
					<th>Công ty</th>
					<th>Địa chỉ</th>
					<th>Email</th>
					<th>Giới thiệu/Mô tả</th>
					<th>Yêu cầu</th>
					<th><center>Số lượng TTS</center></th>
					<th><center>Đã đăng ký</center></th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php if (isset($list)) foreach ($list as $item){
					$tmp = explode("|",$item->email);?>
				<tr>
					<td><input type="checkbox" name="selected[]" value="<?php echo $item->id;?>"/></td>
					<td><?php echo $item->id;?></td>
					<td><?php echo $item->name;?></td>
					<td><?php echo $item->address;?></td>
					<td><?php echo $tmp[0]?></td>
					<td><?php echo str_replace('\n',"<br/>\n",str_replace('\r\n',"<br/>\n",$item->description));?></td>
					<td><?php echo str_replace('\n',"<br/>\n",str_replace('\r\n',"<br/>\n",$item->requirement));?></td>
					<td><?php echo $item->traineeNum;?></td>
					<td><?php echo $item->regNum;?></td>
					<td>
						<input type="image" onclick="window.location='<?php echo site_url($route2link.'/edit/'.$item->id);?>';return false;" src="<?php echo base_url();?>images/icn_edit.png" title="Edit">
					</td>
				</tr>
				<?php }?>
			</tbody>
		</table>
	</div>
	<!-- end of #tab1 -->
</div><!-- end of .tab_container --> 
</form>
</article><!-- end of content manager article -->
<script type="text/javascript">
	$(document).ready(function(){ 
		$(".tablesorter").tablesorter({headers:{0:{sorter:false}}}); 
	});
</script>

<div id='delete-comfirm' style='display:none;'>
	Are you sure you want to delete these companies?
</div>
<script type="text/javascript">
	function deleteCompany(){
		$('#delete-comfirm').dialog("destroy");
		$('#delete-comfirm').dialog({
			height:180,
			width: 320,
			modal: true,
			title: 'Thuctap.com',
			buttons: {
                'Cancel': function(){
                    $( this ).dialog("close");
                },
				'Delete': function() {
					$("#form").submit();	
                }
			}
		});	
	}
</script>